@extends('layouts.admin')

@section('title','属性编辑')

@section('content')
    <!-- Main content -->
    <section class="content">
		<div class="box box-primary">
			<div class="box-header with-border">
				<h3 class="box-title">Quick Example</h3>
			</div>
			<!-- /.box-header -->
			<!-- form start -->
			<form role="form" action="{{ route('admin.attribute.update') }}" method="POST">
				{{csrf_field()}}
				<input type="hidden" name="attr_id" value="{{ $attr->id }}">
				<div class="box-body">
					<div class="form-group">
					   <label>属性名称</label>
					   <input type="text" class="form-control" id="name" name="name" value="{{ $attr->name }}" placeholder="属性名称">
					</div>

	            	<div class="form-group">
	            	    <label>选择分类</label>
	            	    <select class="form-control select2" style="width: 100%;" name="cat_id">
							@foreach($categorys as $key => $category)
	            	        	<option value="{{$category->id}}" @if($attr->cat_id == $category->id) checked="checked"  @endif >{{$category->name}}</option>
	            	        	@if($category->allChildrenCategorys->count())
		        	            	@foreach($category->allChildrenCategorys as $key=>$v)
		        	            	<option value="{{$v->id}}" @if($attr->cat_id == $v->id) checked="checked"  @endif>𠃊{{$v->name}}</option>
		        	            	@endforeach
	            	        	@endif
							@endforeach
	            	  </select>
	            	</div>

	            	<div class="form-group">
	            		<label>输入类型</label>
	            		<br>
                  		<input type="radio" name="input_type" class="minimal" value="0" @if($attr->input_type == 0) checked @endif>
                  		手工输入
	                  	<input type="radio" name="input_type" class="minimal" value="1" @if($attr->input_type == 1) checked @endif>
	                  	选择输入
	                  	<input type="radio" name="input_type" class="minimal" value="2" @if($attr->input_type == 2) checked @endif>
						多行文本输入
					</div>

	            	<div class="form-group">
	            		<label>选择类型</label>
	            		<br>
	                  	<input type="radio" name="select_type" class="minimal" value="1" @if($attr->select_type == 1) checked @endif>
	                  	多选
	                  	<input type="radio" name="select_type" class="minimal" value="2" @if($attr->select_type == 2) checked @endif>
						单选
					</div>
					
					<div class="form-group">
						<label>属性值(多个属性值使用‘|’隔开)</label>
						<textarea class="form-control" name="value" rows="3" placeholder="多个属性值使用‘|’隔开">{{ $valsStr }}</textarea>
					</div>

				</div>
					<!-- /.box-body -->

				<div class="box-footer">
					<button type="submit" class="btn btn-primary btn-submit" data-check="">提交</button>
				</div>
			</form>
		</div>
    </section>
@stop